3.3.90 \(\int \sec ^n(e+f x) (a+a \sec (e+f x))^2 \, dx\) [290]

Optimal. Leaf size=172 \[ \frac {a^2 \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n)}-\frac {a^2 (1+2 n) \, _2F_1\left (\frac {1}{2},\frac {1-n}{2};\frac {3-n}{2};\cos ^2(e+f x)\right ) \sec ^{-1+n}(e+f x) \sin (e+f x)}{f \left (1-n^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {2 a^2 \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right ) \sec ^n(e+f x) \sin (e+f x)}{f n \sqrt {\sin ^2(e+f x)}} \]

[Out]

a^2*sec(f*x+e)^(1+n)*sin(f*x+e)/f/(1+n)-a^2*(1+2*n)*hypergeom([1/2, 1/2-1/2*n],[3/2-1/2*n],cos(f*x+e)^2)*sec(f
*x+e)^(-1+n)*sin(f*x+e)/f/(-n^2+1)/(sin(f*x+e)^2)^(1/2)+2*a^2*hypergeom([1/2, -1/2*n],[1-1/2*n],cos(f*x+e)^2)*
sec(f*x+e)^n*sin(f*x+e)/f/n/(sin(f*x+e)^2)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.10, antiderivative size = 172, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3873, 3857, 2722, 4131} \begin {gather*} -\frac {a^2 (2 n+1) \sin (e+f x) \sec ^{n-1}(e+f x) \, _2F_1\left (\frac {1}{2},\frac {1-n}{2};\frac {3-n}{2};\cos ^2(e+f x)\right )}{f \left (1-n^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {2 a^2 \sin (e+f x) \sec ^n(e+f x) \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right )}{f n \sqrt {\sin ^2(e+f x)}}+\frac {a^2 \sin (e+f x) \sec ^{n+1}(e+f x)}{f (n+1)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sec[e + f*x]^n*(a + a*Sec[e + f*x])^2,x]

[Out]

(a^2*Sec[e + f*x]^(1 + n)*Sin[e + f*x])/(f*(1 + n)) - (a^2*(1 + 2*n)*Hypergeometric2F1[1/2, (1 - n)/2, (3 - n)
/2, Cos[e + f*x]^2]*Sec[e + f*x]^(-1 + n)*Sin[e + f*x])/(f*(1 - n^2)*Sqrt[Sin[e + f*x]^2]) + (2*a^2*Hypergeome
tric2F1[1/2, -1/2*n, (2 - n)/2, Cos[e + f*x]^2]*Sec[e + f*x]^n*Sin[e + f*x])/(f*n*Sqrt[Sin[e + f*x]^2])

Rule 2722

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*((b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1
)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n
}, x] &&  !IntegerQ[2*n]

Rule 3857

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x])^(n - 1)*((Sin[c + d*x]/b)^(n - 1)
*Int[1/(Sin[c + d*x]/b)^n, x]), x] /; FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]

Rule 3873

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^2, x_Symbol] :> Dist[2*a*(b/d
), Int[(d*Csc[e + f*x])^(n + 1), x], x] + Int[(d*Csc[e + f*x])^n*(a^2 + b^2*Csc[e + f*x]^2), x] /; FreeQ[{a, b
, d, e, f, n}, x]

Rule 4131

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) + (A_)), x_Symbol] :> Simp[(-C)*Cot
[e + f*x]*((b*Csc[e + f*x])^m/(f*(m + 1))), x] + Dist[(C*m + A*(m + 1))/(m + 1), Int[(b*Csc[e + f*x])^m, x], x
] /; FreeQ[{b, e, f, A, C, m}, x] && NeQ[C*m + A*(m + 1), 0] &&  !LeQ[m, -1]

Rubi steps

\begin {align*} \int \sec ^n(e+f x) (a+a \sec (e+f x))^2 \, dx &=\left (2 a^2\right ) \int \sec ^{1+n}(e+f x) \, dx+\int \sec ^n(e+f x) \left (a^2+a^2 \sec ^2(e+f x)\right ) \, dx\\ &=\frac {a^2 \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n)}+\frac {\left (a^2 (1+2 n)\right ) \int \sec ^n(e+f x) \, dx}{1+n}+\left (2 a^2 \cos ^n(e+f x) \sec ^n(e+f x)\right ) \int \cos ^{-1-n}(e+f x) \, dx\\ &=\frac {a^2 \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n)}+\frac {2 a^2 \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right ) \sec ^n(e+f x) \sin (e+f x)}{f n \sqrt {\sin ^2(e+f x)}}+\frac {\left (a^2 (1+2 n) \cos ^n(e+f x) \sec ^n(e+f x)\right ) \int \cos ^{-n}(e+f x) \, dx}{1+n}\\ &=\frac {a^2 \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n)}-\frac {a^2 (1+2 n) \, _2F_1\left (\frac {1}{2},\frac {1-n}{2};\frac {3-n}{2};\cos ^2(e+f x)\right ) \sec ^{-1+n}(e+f x) \sin (e+f x)}{f \left (1-n^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {2 a^2 \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right ) \sec ^n(e+f x) \sin (e+f x)}{f n \sqrt {\sin ^2(e+f x)}}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains complex when optimal does not.
time = 1.10, size = 222, normalized size = 1.29 \begin {gather*} -\frac {i 2^{-2+n} a^2 \left (\frac {e^{i (e+f x)}}{1+e^{2 i (e+f x)}}\right )^n (1+\cos (e+f x))^2 \left (\frac {4 e^{i (e+f x)} \, _2F_1\left (1,\frac {1-n}{2};\frac {3+n}{2};-e^{2 i (e+f x)}\right )}{1+n}+\frac {\left (1+e^{2 i (e+f x)}\right ) \, _2F_1\left (1,1-\frac {n}{2};\frac {2+n}{2};-e^{2 i (e+f x)}\right )}{n}+\frac {4 e^{2 i (e+f x)} \, _2F_1\left (1,-\frac {n}{2};\frac {4+n}{2};-e^{2 i (e+f x)}\right )}{\left (1+e^{2 i (e+f x)}\right ) (2+n)}\right ) \sec ^4\left (\frac {1}{2} (e+f x)\right )}{f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sec[e + f*x]^n*(a + a*Sec[e + f*x])^2,x]

[Out]

((-I)*2^(-2 + n)*a^2*(E^(I*(e + f*x))/(1 + E^((2*I)*(e + f*x))))^n*(1 + Cos[e + f*x])^2*((4*E^(I*(e + f*x))*Hy
pergeometric2F1[1, (1 - n)/2, (3 + n)/2, -E^((2*I)*(e + f*x))])/(1 + n) + ((1 + E^((2*I)*(e + f*x)))*Hypergeom
etric2F1[1, 1 - n/2, (2 + n)/2, -E^((2*I)*(e + f*x))])/n + (4*E^((2*I)*(e + f*x))*Hypergeometric2F1[1, -1/2*n,
 (4 + n)/2, -E^((2*I)*(e + f*x))])/((1 + E^((2*I)*(e + f*x)))*(2 + n)))*Sec[(e + f*x)/2]^4)/f

________________________________________________________________________________________

Maple [F]
time = 0.06, size = 0, normalized size = 0.00 \[\int \left (\sec ^{n}\left (f x +e \right )\right ) \left (a +a \sec \left (f x +e \right )\right )^{2}\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sec(f*x+e)^n*(a+a*sec(f*x+e))^2,x)

[Out]

int(sec(f*x+e)^n*(a+a*sec(f*x+e))^2,x)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(f*x+e)^n*(a+a*sec(f*x+e))^2,x, algorithm="maxima")

[Out]

integrate((a*sec(f*x + e) + a)^2*sec(f*x + e)^n, x)

________________________________________________________________________________________

Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(f*x+e)^n*(a+a*sec(f*x+e))^2,x, algorithm="fricas")

[Out]

integral((a^2*sec(f*x + e)^2 + 2*a^2*sec(f*x + e) + a^2)*sec(f*x + e)^n, x)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{2} \left (\int 2 \sec {\left (e + f x \right )} \sec ^{n}{\left (e + f x \right )}\, dx + \int \sec ^{2}{\left (e + f x \right )} \sec ^{n}{\left (e + f x \right )}\, dx + \int \sec ^{n}{\left (e + f x \right )}\, dx\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(f*x+e)**n*(a+a*sec(f*x+e))**2,x)

[Out]

a**2*(Integral(2*sec(e + f*x)*sec(e + f*x)**n, x) + Integral(sec(e + f*x)**2*sec(e + f*x)**n, x) + Integral(se
c(e + f*x)**n, x))

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(f*x+e)^n*(a+a*sec(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((a*sec(f*x + e) + a)^2*sec(f*x + e)^n, x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (a+\frac {a}{\cos \left (e+f\,x\right )}\right )}^2\,{\left (\frac {1}{\cos \left (e+f\,x\right )}\right )}^n \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + a/cos(e + f*x))^2*(1/cos(e + f*x))^n,x)

[Out]

int((a + a/cos(e + f*x))^2*(1/cos(e + f*x))^n, x)

________________________________________________________________________________________